package com.yunxi.controller.vehicle;

import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.vehicle.pojo.VehicleConfigVO;
import com.yunxi.vehicle.pojo.VehicleSpectrumVO;
import com.yunxi.vehicle.service.VehicleConfigDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 工程配置 前端控制器
 * </p>
 *
 * @author XUQI
 * @since 2019-07-18
 */
@RestController
@RequestMapping("/admin/vehicleConfig")
@Api(tags = "PMS:VEHICLECONFIG", description = "工程配置版本明细接口")
public class VehicleConfigController {

    private static final Logger logger = LoggerFactory.getLogger(VehicleConfigController.class);

    @Autowired
    VehicleConfigDubboService baseVehicleConfigDubboService;

    @GetMapping("/listByFamilyCode")
    @ApiOperation(value = "根据特征族编码查询特征值集合")
    public ApiResult listByFamilyCode(String familyCode) {
        return ResponseUtil.ok(baseVehicleConfigDubboService.findConfigFeatureByFamilyCode(familyCode));
    }

    @PostMapping("/save")
    @ApiOperation(value = "保存信息")
    public ApiResult save(@RequestBody VehicleConfigVO vehicleConfigVO, @CurrentUser LoginInfo loginInfo) throws Exception {
        baseVehicleConfigDubboService.saveOrUpdate(vehicleConfigVO);
        return ResponseUtil.ok("success");
    }

    @GetMapping("/country")
    @ApiOperation(value = "国别特征值集合")
    public ApiResult country() {
        return ResponseUtil.ok(baseVehicleConfigDubboService.findConfigFeatureByFamilyCode("MS_"));
    }


/*@PostMapping("/export")
@ApiOperation(value = "导出excel")
public Object export(@RequestParam Map<String,Object> params) throws Exception {
return ResponseUtil.ok(baseVehicleConfigVerDubboService.findMapByList(params));
}*/
}
